import java.util.*;

public class RandomizedSet {
    private Set<Integer> set;
    private List<Integer> list;
    public RandomizedSet() {
        set=new HashSet<>();
        list=new ArrayList<>();
    }

    public boolean insert(int val) {
        return set.add(val);

    }

    public boolean remove(int val) {
        return set.remove(val);
    }

    public int getRandom() {
        Object[] array = set.toArray();
        int r=new Random().nextInt(array.length);
        return (Integer) array[r];
    }
}
